home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Dev / basic / amiblitz_ful.lha / AmiBlitz2 / Examples / fputest.ab2 < prev    next >
Encoding:
Text File  |  1980-03-23  |  1.4 KB  |  49 lines

  1. optimize 2 ;should be set to on because bpm is a basic float value so AB2 must know
  2.                    ;to do all float calculations in IEEEE singel floating point and not in ffp 
  3. timeindex_midi.l  = 768*5000   ; 5000 Bars a 768 Ticks
  4. timeindex_audio.l = 0          ; should be calculated
  5. samplerate.l      = 48000      ; max samplerate
  6. bpm.f             = 255        ; max bpm
  7.  
  8.  
  9.  
  10. ; setup data for ASM
  11. Poke.l ?timeindex_midi,timeindex_midi
  12. Poke.l ?timeindex_audio,timeindex_audio
  13. Poke.f ?bpm,bpm
  14. Poke.l ?samplerate,samplerate
  15.  
  16. ;The above pokes are not need if you access var in this way
  17. fmove.l timeindex_midi@(a5),fp0           ; let direct access the basic var
  18.  
  19.  
  20. ; calculate with FPU
  21. fmove.l timeindex_midi,fp0                ; fp0 = timeinedx_midi.l
  22. fmove.l #5,fp1          : fmul.x fp1,fp0    ; fp0 * 5
  23. fmove.l #16,fp1         : fdiv.x fp1,fp0    ; fp0 / 16
  24. fmove.s bpm,fp1         : fdiv.x fp1,fp0    ; fp0 / bpm.f
  25. fmove.l samplerate,fp1  : fmul.x fp1,fp0    ; fp0 * samplerate.l
  26. fmove.l fp0,timeindex_audio               ; timeindex_audio.l = fp0
  27.  
  28.  
  29. ; Calculate with blitz
  30. a.f = timeindex_midi
  31. a.f * 5 / 16 / bpm * samplerate
  32. timeindex_audio = a
  33.  
  34.  
  35.  
  36.  
  37. NPrint "Blitz2: ",timeindex_audio,"  / FPU ASM: ",Peek.l(?timeindex_audio)
  38.  
  39.  
  40. VWait 500
  41. End
  42.  
  43. samplerate:      Dc.l 0
  44. bpm:             Dc.l 0
  45. timeindex_midi:  Dc.l 0
  46. timeindex_audio: Dc.l 0
  47.  
  48.  
  49.